package com.deyuanyun.pic.pipe.domain.custom;

import com.deyuanyun.pic.common.util.ConvertUtil;
import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.pipe.domain.PicPipePipeCross;
import com.deyuanyun.pic.pipe.domain.exceldomain.CrossingOverInfoVO;

/**
 * Created by xu on 2015/12/31.
 */
public class CustomPicPipePipeCross extends PicPipePipeCross {
    private String lineName;
    private String segmentName;

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public String getSegmentName() {
        return segmentName;
    }

    public void setSegmentName(String segmentName) {
        this.segmentName = segmentName;
    }

    public CrossingOverInfoVO toCrossingOverInfo(CustomPicPipePipeCross cross) throws Exception {
        //PipeCrossService pipeCrossService = SpringAppliction.getBean(PipeCrossService.class);
        PicPipePipeCross cross1=new PicPipePipeCross();
        ConvertUtil.copy(cross,cross1);

        CrossingOverInfoVO b=new CrossingOverInfoVO();
        ConvertUtil.copy(cross1,b);

        if (this.getRecordtime()!=null){
            b.setRecordtime(com.deyuanyun.pic.common.util.DateUtil.DateToStringYMd(this.getRecordtime()));
        }
        b.setBegiinLineloopX(ObjectUtil.nvl(this.getFromMileage(),""));
        b.setBegiinLineloopY(this.getFromReference());
        b.setBegiinLineloopZ(ObjectUtil.nvl(this.getFromReferenceDistance(),""));

        b.setEndLineloopX( ObjectUtil.nvl(this.getToMileage(),"") );
        b.setEndLineloopY(this.getToReference());
        b.setEndLineloopZ(ObjectUtil.nvl(this.getToReferenceDistance(),""));



        b.setPipeLineId(this.getLineName());
        b.setPipeSegmentId(this.getSegmentName());
        //b.setPipeLineId(this.getPipeLineId());
        //b.setPipeSegmentId(this.getPipeSegmentId());
        //b.setAssemblyCompany(this.getAssemblyCompany());

        return b;
    }

}
